package com.lgkj.zhm.controller;

import java.util.List;

import com.lgkj.zhm.util.domain.AjaxResult;
import com.lgkj.zhm.util.page.TableDataInfo;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.lgkj.zhm.domain.SwipingCardTime;
import com.lgkj.zhm.service.ISwipingCardTimeService;

/**
 * 刷卡记录Controller
 *
 * @author 代星登
 * @date 2021-02-25
 */
@RestController
@RequestMapping("/SwipingCardTime")
public class SwipingCardTimeController extends BaseController
{
    @Autowired
    private ISwipingCardTimeService swipingCardTimeService;

    /**
     * 查询刷卡记录列表
     */

    @GetMapping("/list")
    public TableDataInfo list(SwipingCardTime swipingCardTime)
    {
        startPage();
        List<SwipingCardTime> list = swipingCardTimeService.selectSwipingCardTimeList(swipingCardTime);
        return getDataTable(list);
    }

    /**
     * 导出刷卡记录列表
     *//*
    @PreAuthorize("@ss.hasPermi('zhm:SwipingCardTime:export')")
    @Log(title = "刷卡记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(SwipingCardTime swipingCardTime)
    {
        List<SwipingCardTime> list = swipingCardTimeService.selectSwipingCardTimeList(swipingCardTime);
        ExcelUtil<SwipingCardTime> util = new ExcelUtil<SwipingCardTime>(SwipingCardTime.class);
        return util.exportExcel(list, "SwipingCardTime");
    }
*/
    /**
     * 获取刷卡记录详细信息
     */

    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(swipingCardTimeService.selectSwipingCardTimeById(id));
    }

    /**
     * 新增刷卡记录
     */


    @PostMapping(value = "/add")
    public AjaxResult add(@RequestBody SwipingCardTime swipingCardTime)
    {
        return toAjax(swipingCardTimeService.insertSwipingCardTime(swipingCardTime));
    }


    /**
     * 修改刷卡记录
     */

    @PutMapping(value = "/edit")
    public AjaxResult edit(@RequestBody SwipingCardTime swipingCardTime)
    {
        return toAjax(swipingCardTimeService.updateSwipingCardTime(swipingCardTime));
    }

    /**
     * 删除刷卡记录
     */

	@DeleteMapping("/del/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {

        return toAjax(swipingCardTimeService.deleteSwipingCardTimeByIds(ids));

    }
}
